<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('培训档案列表')" />
    <th:block th:include="include :: layout-latest-css" />
    <th:block th:include="include :: ztree-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>员工工号：</label>
                                <input type="text" name="empNum"/>
                            </li>
                            <li>
                                <label>员工姓名：</label>
                                <input type="text" name="empName"/>
                            </li>

                            <li>
                                <label>职位：</label>
                                <select id="postId"  name="postId" th:with="postAll=${@postService.getPostAll()}">
                                    <option value="">所有</option>
                                    <option th:each="post : ${postAll}" th:text="${post.getPostName()}" th:value="${post.getPostId()}"  th:hidden="${post.getStatus() == '1'}"></option>
                                </select>
                            </li>
                            <li>
                                <label>培训内容：</label>
                                <input type="text" name="trainingContent"/>
                            </li>
                            <li>
                                <label>培训方式：</label>
                                <select name="trainingType" >
                                    <option value="">所有</option>
                                    <option value="0">面授</option>
                                    <option value="1">网授</option>
                                </select>
                            </li>

                            <div th:include="include/deptSearch::deptSearch"></div>

                            <li>
                                <label>是否考试：</label>
                                <select name="examFlag" >
                                    <option value="">所有</option>
                                    <option value="0">是</option>
                                    <option value="1">否</option>
                                </select>
                            </li>
                            <li>
                                <label>是否通过：</label>
                                <select name="passFlag" >
                                    <option value="">所有</option>
                                    <option value="0">是</option>
                                    <option value="1">否</option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>培训开始时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="trainingStartTime"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="trainingEndTime"/>
                            </li>

                            <li>
                                <label>培训时长：</label>
                                <input type="text" id="trainingStartTime" placeholder="" name="startLongTime"/>
                                <span>-</span>
                                <input type="text" id="trainingEndTime" placeholder="" name="endLongTime"/>
                            </li>

                            <li>
                                <label>培训成绩：</label>
                                <input type="text" id="startScore" placeholder="" name="startScore"/>
                                <span>-</span>
                                <input type="text" id="endScore" placeholder="" name="endScore"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="hr:records:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="hr:records:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="hr:records:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="hr:records:export">
                    <i class="fa fa-download"></i> 导出
                </a>

                <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="employee:emp:import">
                    <i class="fa fa-upload"></i> 导入
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table class="bootstrap-table" id="bootstrap-table"></table>
            </div>
        </div>
    </div>
     <th:block th:include="include :: footer" />
     <th:block th:include="include :: layout-latest-js" />
     <th:block th:include="include :: ztree-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('hr:records:edit')}]];
        var removeFlag = [[${@permission.hasPermi('hr:records:remove')}]];
        var prefix = ctx + "hr/records";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                importUrl: prefix + "/importData",
                modalName: "培训档案",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id', 
                    title: 'id',
                    visible: false
                },
                {
                    field: 'empNum', 
                    title: '员工工号'
                },
                {
                    field: 'empName', 
                    title: '员工姓名'
                },
                {
                    field: 'deptId', 
                    title: '部门id',visible: false
                },
                {
                    field: 'deptName',
                    title: '所属部门'
                },
                {
                    field: 'postId', 
                    title: '岗位id',visible: false
                },
                {
                    field: 'postName',
                    title: '职位'
                },
                {
                    field: 'trainingTimeTotal',
                    title: '总培训时长'
                },
                {
                    field: 'participateTotal', 
                    title: '培训次数'
                },
                {
                    field: 'trainingStartTime', 
                    title: '培训开始时间'
                },
                {
                    field: 'trainingEndTime', 
                    title: '培训结束时间'
                },
                {
                    field: 'trainingSite', 
                    title: '培训地点'
                },
                {
                    field: 'trainingType', 
                    title: '培训方式',visible: false
                },
                {
                    field: 'trainingTypeName',
                    title: '培训方式'
                },
                {
                    field: 'trainingContent', 
                    title: '培训内容',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    field: 'trainingTime',
                    title: '培训时长'
                },
                {
                    field: 'trainingScore',
                    title: '培训成绩'
                },
                {
                    field: 'examFlag', 
                    title: '是否考试',visible: false
                },
                {
                    field: 'passFlag', 
                    title: '是否通过',visible: false
                },
                {
                    field: 'examFlagName',
                    title: '是否考试'
                },
                {
                    field: 'passFlagName',
                    title: '是否通过'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        /**
         * 导出模板
         */
         function importTemplate() {
            $.get(prefix+"/importTemplate", function(result) {
                if (result.code == web_status.SUCCESS) {
                    window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
                } else if (result.code == web_status.WARNING) {
                    $.modal.alertWarning(result.msg)
                } else {
                    $.modal.alertError(result.msg);
                }
            });
        }

    </script>
     <!-- 导入区域 -->
     <script id="importTpl" type="text/template">
         <form enctype="multipart/form-data" class="mt20 mb10">
             <div class="col-xs-offset-1">
                <span>第一步：</span> <a onclick="importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
             </div>
             <div class="col-xs-offset-1">
                 <span>第二步：</span> <input type="file" id="file" name="file"/>　
                 <font color="red" class="pull-left mt10">
                     提示：仅允许导入“xls”或“xlsx”格式文件！
                 </font>
             </div>
         </form>
     </script>



</body>
</html>